﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Purchase.ApiS.AllCation.Command.MaterialInfos;
using Purchase.ApiS.AllCation.Command.Quality;
using Purchase.ApiS.AllCation.Command.Supplier;
using Purchase.ErrorCode;

namespace Purchase.ApiS.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SupplierPostController : ControllerBase
    {
        public readonly IMediator mediator;

        public SupplierPostController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 添加供应商信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> PostQuery(AddSupplierCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 添加供应商等级信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> Post(AddSupplierGradeCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 新增采购合同信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddPurchaseContractModel(AddPurchaseContractModelCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 添加物料信息的方法
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> GetMaterielInfo(AddMaterialInfoCommand request)
        {
            return mediator.Send(request);
        }
    }
}
